//Stephen Erb Application GUI

import javax.swing.*;

import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.text.AbstractDocument;
import javax.swing.text.MaskFormatter;

public class Person extends JFrame implements ActionListener{
        
        JFrame s;
        JFrame fN;
        JFrame mN;
        JFrame lN;
        JFrame a;
	boolean done;
	JButton ok;
	JButton close;
	private String fName;
	private String lName;
	private String mName;
	private int age;
	private long ssn;
	JTextField fNameT;
	JTextField mNameT;
	JTextField lNameT;
	JTextField ageT;
	JTextField ssnT;
	public Person() throws Exception
	{
		done=false;
		fName="";
		lName="";
		mName="";
		age=0;
		ssn=0;
		setLayout(new GridLayout(10, 2, 5, 5));
		JLabel fNameL= new JLabel("First Name: ");
                fNameT= new JTextField(25);
                ((AbstractDocument) fNameT.getDocument()).setDocumentFilter(new AdvisorFieldDocumentFilter());
		JLabel mNameL= new JLabel("Middle Name: ");
                mNameT= new JTextField(25);
                ((AbstractDocument) mNameT.getDocument()).setDocumentFilter(new AdvisorFieldDocumentFilter());
		JLabel lNameL= new JLabel("Last Name: ");
                lNameT= new JTextField(25);
                ((AbstractDocument) lNameT.getDocument()).setDocumentFilter(new AdvisorFieldDocumentFilter());
		JLabel ageL= new JLabel("Age: ");
		ageT= new JTextField(12);
                ((AbstractDocument) ageT.getDocument()).setDocumentFilter(new AgeFieldDocumentFilter());
		JLabel ssnL= new JLabel("SSN: ");
		ssnT= new JTextField(9);
                ((AbstractDocument) ssnT.getDocument()).setDocumentFilter(new SSNFieldDocumentFilter());
		ok=new JButton("OK");
		close=new JButton("Close");
		ok.setActionCommand("OK");
		close.setActionCommand("CLOSE");
		ok.addActionListener(this);
		close.addActionListener(this);
		add(fNameL);
		add(fNameT);
		add(mNameL);
		add(mNameT);
		add(lNameL);
		add(lNameT);
		add(ageL);
		add(ageT);
		add(ssnL);
		add(ssnT);
		add(ok);
		add(close);
	}
        public boolean proceedOnward() 
        {
            boolean valid=true;
            if(validateFName()==false) valid=false;
            if(validateMName()==false)valid=false;
            if(validateLName()==false) valid=false;
            if(validateAge()==false) valid=false;
            if(validateSSN()==false) valid=false;
            return valid;
        }
        public boolean validateMName() {
            boolean valid=true;
            boolean size=true;
            char[] temp=mNameT.getText().trim().toCharArray();
            for(int i=0; i<temp.length;i++) {
                if(temp[i]<'A' || temp[i]>'Z')
                {
                    if(temp[i]<'a' || temp[i]>'z')
                    {
                        if(temp[i]!=' ')valid=false;
                    }
                }
            }
            if(temp.length>25 || temp.length==0)size=false;
            if(valid==false || size==false) {
                mN=new JFrame("Middle Name Error Message");
                mN.setLayout(new GridLayout(2, 1, 5, 5));
                JButton close= new JButton("Close");
                close.setActionCommand("MNAMEERRORCLOSEBOX");
                close.addActionListener(this);
                JLabel eL=new JLabel();
                if(valid==false && size==true) {
                    eL.setText("Only letters and spaces!");   
                }else if(valid==false && size==false) {
                    eL.setText("Only letters and spaces! Fewer than twenty-five.");
                }else if(valid==true && size==false) {
                    eL.setText("A maximum of twenty-five letters and spaces.");
                }
                mN.add(eL);
                mN.add(close);
                mN.setSize(400,300);
                mN.setLocationRelativeTo(null);
                mN.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                mN.setVisible(true);
            }
            if(valid&&size) {
                setMName(mNameT.getText().trim());
            }
            return (valid && size);   
        }
        public boolean validateFName() {
            boolean valid=true;
            boolean size=true;
            char[] temp=fNameT.getText().trim().toCharArray();
            for(int i=0; i<temp.length;i++) {
                if(temp[i]<'A' || temp[i]>'Z')
                {
                    if(temp[i]<'a' || temp[i]>'z')
                    {
                        if(temp[i]!=' ')valid=false;
                    }
                }
            }
            if(temp.length>25 || temp.length==0)size=false;
            if(valid==false || size==false) {
                fN=new JFrame("First Name Error Message");
                fN.setLayout(new GridLayout(2, 1, 5, 5));
                JButton close= new JButton("Close");
                close.setActionCommand("FNAMEERRORCLOSEBOX");
                close.addActionListener(this);
                JLabel eL=new JLabel();
                if(valid==false && size==true) {
                    eL.setText("Only letters and spaces!");   
                }else if(valid==false && size==false) {
                    eL.setText("Only letters and spaces! Fewer than twenty-five.");
                }else if(valid==true && size==false) {
                    eL.setText("A maximum of twenty-five letters and spaces.");
                }
                fN.add(eL);
                fN.add(close);
                fN.setSize(400,300);
                fN.setLocationRelativeTo(null);
                fN.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                fN.setVisible(true);
            }
            if(valid&&size) {
                setFName(fNameT.getText().trim());
            }
            return (valid && size);   
        }
        public boolean validateAge() {
            boolean valid=true;
            boolean size=true;
            String ageType="default";
            int count=0;
            char[] temp=ageT.getText().toLowerCase().toCharArray();
            if(temp.length==0) size=false;
            else {
                for(int i=0; i<temp.length;i++) {
                    if(temp[i]<'a' || temp[i]>'z')
                    {
                        if(temp[i]!='-')
                        {
                            if(temp[i]!=' ')
                            {
                                valid=false;
                            }
                            else if(temp[i]==' '){
                                ageType="words ";
                                count++;
                            }
                        }
                        else if(temp[i]=='-')
                        {
                            ageType="words-";
                            count++;
                        }
                    }
                    if(valid==true && !ageType.equals("words ") && !ageType.equals("words-")) {
                        ageType="words";
                    }
                }
                if(valid==false && count==0 && !ageType.equals("words") &&temp.length>=1 &&temp.length<4) {
                    valid=true;
                    for(int i=0; i<temp.length;i++) {
                        if(temp[i]<'1' || temp[i]>'9')valid=false;
                    }
                    if(valid)ageType="numbers";
                }
                
            }
            //System.out.println(setAge(ageT.getText()));
            if(valid==false || size==false) {
                a=new JFrame("Age Error Message Box");
                a.setLayout(new GridLayout(2, 1, 5, 5));
                JButton close= new JButton("Close");
                close.setActionCommand("AGEERRORCLOSEBOX");
                close.addActionListener(this);
                JLabel eL=new JLabel();
                if(valid==false && size==true) {
                    eL.setText("Invalid format. Number greater than one(1-100) or format (ninety-nine) or (one hundred).1");   
                }else if(valid==false && size==false) {
                    eL.setText("Invalid format. Number greater than one(1-100) or format (ninety-nine) or (one hundred).2");
                }else if(valid==true && size==false) {
                    eL.setText("Don't leave the text area blank.");
                }else if(count>1) {
                    eL.setText("Invalid format. Number greater than one(1-100) or format (ninety-nine) or (one hundred).1a");
                }else if(ageType.equals("numbers")&& (integerAge(ageT.getText(),ageType)==0) || count>1)
                {
                    eL.setText("Invalid format. Number greater than one(1-100) or format (ninety-nine) or (one hundred).2a");
                }
                    
                a.add(eL);
                a.add(close);
                a.setSize(700,300);
                a.setLocationRelativeTo(null);
                a.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                a.setVisible(true);
            }else if(valid&&size&&(integerAge(ageT.getText(),ageType)==0)&&!ageType.equals("numbers")) 
            {
                a=new JFrame("Age Error Message Box");
                a.setLayout(new GridLayout(2, 1, 5, 5));
                JButton close= new JButton("Close");
                close.setActionCommand("AGEERRORCLOSEBOX");
                close.addActionListener(this);
                JLabel eL=new JLabel();
                eL.setText("Invalid format. Number greater than one(1-100) or format (ninety-nine) or (one hundred).I");
                a.add(eL);
                a.add(close);
                a.setSize(700,300);
                a.setLocationRelativeTo(null);
                a.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                a.setVisible(true);
            }else if(valid&&size && count==0 && !ageType.equals("words")&&(temp.length<=1 ||temp.length>2)) {
                if(Integer.parseInt(ageT.getText())>100 ||Integer.parseInt(ageT.getText())==0) {
                    a=new JFrame("Age Error Message Box");
                    a.setLayout(new GridLayout(2, 1, 5, 5));
                    JButton close= new JButton("Close");
                    close.setActionCommand("AGEERRORCLOSEBOX");
                    close.addActionListener(this);
                    JLabel eL=new JLabel();
                    eL.setText("Invalid format. Number greater than one(1-100) or format (ninety-nine) or (one hundred).II");
                    a.add(eL);
                    a.add(close);
                    a.setSize(700,300);
                    a.setLocationRelativeTo(null);
                    a.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                    a.setVisible(true);
                }
            }
            if(valid&&size && ageType.equals("numbers")&&temp.length>=1 &&temp.length<4) {
                 if(Integer.parseInt(ageT.getText())<=100 && Integer.parseInt(ageT.getText())>0) setAge(Integer.parseInt(ageT.getText()));
            }
            else if(valid&&size&&(count==1 || ageType.equals("words"))&&temp.length>2) {
                if(integerAge(ageT.getText(),ageType)>0)setAge(integerAge(ageT.getText(),ageType));
            }
            if(valid&&size)
            {
                if(count>=1)
                {
                   if(integerAge(ageT.getText(),ageType)==0) 
                    {
                        return false;
                    }
                   else {
                       setAge(integerAge(ageT.getText(),ageType));
                   }
                }
                else if(count==0) {
                    if(integerAge(ageT.getText(),ageType)==0) 
                     {
                         return false;
                     }
                    else {
                        setAge(integerAge(ageT.getText(),ageType));
                    }
                }
                else if((ageType.equals("numbers") &&temp.length>0 &&temp.length<4))
                {
                    if(Integer.parseInt(ageT.getText())>100 || Integer.parseInt(ageT.getText())==0) 
                    {
                        return false;
                    }
                    else 
                    {
                        integerAge(ageT.getText(),ageType);
                    }
                }
                else if(ageType.equals("numbers") &&(temp.length<1 &&temp.length>=4)) {
                    if(integerAge(ageT.getText(),ageType)>100 || integerAge(ageT.getText(),ageType)==0)
                    {
                        return false;   
                    }
                }
            }
            return (valid && size);
        }
        public boolean validateSSN() {
            boolean valid=true;
            boolean size=true;
            char[] temp=ssnT.getText().toCharArray();
            for(int i=0; i<temp.length;i++) {
                if(temp[i]<'0' || temp[i]>'9')valid=false;
            }
            if(temp.length!=9)size=false;
            if(valid==false || size==false) {
                s=new JFrame("Social Security Number Error Message");
                s.setLayout(new GridLayout(2, 1, 5, 5));
                JButton close= new JButton("Close");
                close.setActionCommand("SSNERRORCLOSEBOX");
                close.addActionListener(this);
                JLabel eL=new JLabel();
                if(valid==false && size==true) {
                    eL.setText("Only numbers!");   
                }else if(valid==false && size==false) {
                    eL.setText("Only numbers! Nine numbers to be exact.");
                }else if(valid==true && size==false) {
                    eL.setText("Only nine numbers, no more no less than nine.");
                }
                s.add(eL);
                s.add(close);
                s.setSize(400,300);
                s.setLocationRelativeTo(null);
                s.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                s.setVisible(true);
            }
            if(valid&&size) {
                setSSN(Long.valueOf(ssnT.getText()).longValue());
            }
            return (valid && size);
        }
        public boolean validateLName() {
            boolean valid=true;
            boolean size=true;
            char[] temp=lNameT.getText().trim().toCharArray();
            for(int i=0; i<temp.length;i++) {
                if(temp[i]<'A' || temp[i]>'Z')
                {
                    if(temp[i]<'a' || temp[i]>'z')
                    {
                        if(temp[i]!=' ')valid=false;
                    }
                }
            }
            if(temp.length>25 || temp.length==0)size=false;
            if(valid==false || size==false) {
                lN=new JFrame("First Name Error Message");
                lN.setLayout(new GridLayout(2, 1, 5, 5));
                JButton close= new JButton("Close");
                close.setActionCommand("LNAMEERRORCLOSEBOX");
                close.addActionListener(this);
                JLabel eL=new JLabel();
                if(valid==false && size==true) {
                    eL.setText("Only letters and spaces!");   
                }else if(valid==false && size==false) {
                    eL.setText("Only letters and spaces! Fewer than twenty-five.");
                }else if(valid==true && size==false) {
                    eL.setText("A maximum of twenty-five letters and spaces.");
                }
                lN.add(eL);
                lN.add(close);
                lN.setSize(400,300);
                lN.setLocationRelativeTo(null);
                lN.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                lN.setVisible(true);
            }
            if(valid&&size) {
                setLName(lNameT.getText().trim());
            }
            return (valid && size);   
        }
	public void initialize()
	{
		this.setTitle("Person");
		this.setSize(400,300);
		this.setLocationRelativeTo(null);
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setVisible(true);
	}
	public void actionPerformed(ActionEvent event)
	{
		String command=event.getActionCommand();
		if(command=="OK")
		{
                        if(proceedOnward()) {
                            System.out.println(toString());
                            System.exit(0);  
                        }
		}
		else if(command=="CLOSE")
		{
			dispose();
                        Choose c1=new Choose();
                        c1.initialize();
		}
                else if(command=="SSNERRORCLOSEBOX") 
                {
                        s.dispose();
                }
                else if(command=="AGEERRORCLOSEBOX") 
                {
                        a.dispose();
                }
                else if(command=="FNAMEERRORCLOSEBOX") 
                {
                        fN.dispose();
                }
                else if(command=="MNAMEERRORCLOSEBOX") 
                {
                        mN.dispose();
                }
                else if(command=="LNAMEERRORCLOSEBOX") 
                {
                        lN.dispose();
                }
	}
	public String getFName()
	{
		return fName;
	}
	public String getLName()
	{
		return lName;
	}
	public String getMName()
	{
		return mName;
	}
	public long getSSN()
	{
		return ssn;
	}
        public int getAge() 
        {
                return age;
        }
        public void setFName(String temp) 
        {
                fName=temp;
        }
        public void setLName(String temp) 
        {   
                lName=temp;
        }
        public void setMName(String temp) 
        {
                mName=temp;
        }
        public void setSSN(long temp) 
        {
                ssn=temp;
        }
        public void setAge(int tempA) {
                age=tempA;
        }

	public int integerAge(String tempA, String ageType)
	{
                boolean accessed=false;
		int tempAge=0;
		String temp=tempA.toLowerCase().trim();
                String[] a= new String[]{"null","null"};
                
                if(ageType.equals("words-"))a=temp.split("-");
                else if(ageType.equals("words "))a=temp.split(" ");
                if(temp.equals("ten")&& ageType.equals("words"))
                {
                        tempAge=10;
                        accessed=true;
                }
                else if(temp.equals("eleven")&& ageType.equals("words"))
                {
                        tempAge=11;
                        accessed=true;
                }
                else if(temp.equals("twelve")&& ageType.equals("words"))
                {
                        tempAge=12;
                        accessed=true;
                }
                else if(temp.equals("thirteen")&& ageType.equals("words"))
                {
                        tempAge=13;
                        accessed=true;
                }
                else if(temp.equals("fourteen")&& ageType.equals("words"))
                {
                        tempAge=14;
                        accessed=true;
                }
                else if(temp.equals("fifteen")&& ageType.equals("words"))
                {
                        tempAge=15;
                        accessed=true;
                }
                else if(temp.equals("sixteen")&& ageType.equals("words"))
                {
                        tempAge=16;
                        accessed=true;
                }
                else if(temp.equals("seventeen")&& ageType.equals("words"))
                {
                        tempAge+=17;
                        accessed=true;
                }
                else if(temp.equals("eighteen")&& ageType.equals("words"))
                {
                        tempAge=18;
                        accessed=true;
                }
                else if(temp.equals("nineteen")&& ageType.equals("words"))
                {
                        tempAge=19;
                        accessed=true;
                }
                else if(temp.equals("twenty")&& ageType.equals("words")|| (a[0].equals("twenty")&& ageType.equals("words-")))
                {
                        tempAge=20;
                        accessed=true;
                }
                else if(temp.equals("thirty")&& ageType.equals("words")|| (a[0].equals("thirty")&& ageType.equals("words-")))
                {
                        tempAge=30;
                        accessed=true;
                }
                else if(temp.equals("forty")&& ageType.equals("words")|| (a[0].equals("forty")&& ageType.equals("words-")))
                {
                        tempAge=40;
                        accessed=true;
                }
                else if(temp.equals("fifty")&& ageType.equals("words")|| (a[0].equals("fifty")&& ageType.equals("words-")))
                {
                        tempAge=50;
                        accessed=true;
                }
                else if(temp.equals("sixty")&& ageType.equals("words")|| (a[0].equals("sixty")&& ageType.equals("words-")))
                {
                        tempAge=60;
                        accessed=true;
                }
                else if(temp.equals("seventy")&& ageType.equals("words")|| (a[0].equals("seventy")&& ageType.equals("words-")))
                {
                        tempAge=70;
                        accessed=true;
                }
                else if(temp.equals("eighty")&& ageType.equals("words")|| (a[0].equals("eighty")&& ageType.equals("words-")))
                {
                        tempAge=80;
                        accessed=true;
                }
                else if(temp.equals("ninety")&& ageType.equals("words")|| (a[0].equals("ninety")&& ageType.equals("words-")))
                {
                        tempAge=90;
                        accessed=true;
                }
                else if(a[0].equals("one") && a[1].equals("hundred"))
                {
                        tempAge=100;
                        accessed=true;
                }
	    if((temp.equals("zero")&& ageType.equals("words")) || (a[1].equals("zero")&& ageType.equals("words-")))
	    {
                    if((a[1].equals("zero")&& ageType.equals("words-"))&& tempAge==0) {
                        accessed=false;
                        tempAge=0;
                    }
                    else if((temp.equals("zero")&& ageType.equals("words")))
                    {
                        accessed=true;
                        tempAge+=0;
                    }
                    else if((a[1].equals("zero")&& ageType.equals("words-"))&&tempAge!=0) {
                        tempAge+=0;
                        accessed=true;
                    }
                    else tempAge=0;
	    }
	    else if((temp.equals("one")&& ageType.equals("words")) ||(a[1].equals("one")&& ageType.equals("words-")))
	    {
	        if((a[1].equals("one")&& ageType.equals("words-"))&& tempAge==0) {
	            accessed=false;
	            tempAge=0;
	        }
	        else if((temp.equals("one")&& ageType.equals("words")))
	        {
	            accessed=true;
	            tempAge+=1;
	        }
	        else if((a[1].equals("one")&& ageType.equals("words-"))&&tempAge!=0) {
	            tempAge+=1;
	            accessed=true;
	        }
	        else tempAge=0;
	    }
	    else if(temp.equals("two")&& ageType.equals("words") || (a[1].equals("two")&& ageType.equals("words-")))
	    {
	        if((a[1].equals("two")&& ageType.equals("words-"))&& tempAge==0) {
	            accessed=false;
	            tempAge=0;
	        }
	        else if((temp.equals("two")&& ageType.equals("words")))
	        {
	            accessed=true;
	            tempAge+=2;
	        }
	        else if((a[1].equals("two")&& ageType.equals("words-"))&&tempAge!=0) {
	            tempAge+=2;
	            accessed=true;
	        }
	        else tempAge=0;
	    }
	    else if(temp.equals("three")&& ageType.equals("words") || (a[1].equals("three")&& ageType.equals("words-")))
	    {
	        if((a[1].equals("three")&& ageType.equals("words-"))&& tempAge==0) {
	            accessed=false;
	            tempAge=0;
	        }
	        else if((temp.equals("three")&& ageType.equals("words")))
	        {
	            accessed=true;
	            tempAge+=(2+1);
	        }
	        else if((a[1].equals("three")&& ageType.equals("words-"))&&tempAge!=0) {
	            tempAge+=(2+1);
	            accessed=true;
	        }
	        else tempAge=0;
	    }
	    else if(temp.equals("four")&& ageType.equals("words") || (a[1].equals("four")&& ageType.equals("words-")))
	    {
	        if((a[1].equals("four")&& ageType.equals("words-"))&& tempAge==0) {
	            accessed=false;
	            tempAge=0;
	        }
	        else if((temp.equals("four")&& ageType.equals("words")))
	        {
	            accessed=true;
	            tempAge+=4;
	        }
	        else if((a[1].equals("four")&& ageType.equals("words-"))&&tempAge!=0) {
	            tempAge+=4;
	            accessed=true;
	        }
	        else tempAge=0;
	    }
	    else if(temp.equals("five")&& ageType.equals("words") || (a[1].equals("five")&& ageType.equals("words-")))
	    {
	        if((a[1].equals("five")&& ageType.equals("words-"))&& tempAge==0) {
	            accessed=false;
	            tempAge=0;
	        }
	        else if((temp.equals("five")&& ageType.equals("words")))
	        {
	            accessed=true;
	            tempAge+=5;
	        }
	        else if((a[1].equals("five")&& ageType.equals("words-"))&&tempAge!=0) {
	            tempAge+=5;
	            accessed=true;
	        }
	        else tempAge=0;
	    }
	    else if(temp.equals("six")&& ageType.equals("words")|| (a[1].equals("six")&& ageType.equals("words-")))
	    {
	        if((a[1].equals("six")&& ageType.equals("words-"))&& tempAge==0) {
	            accessed=false;
	            tempAge=0;
	        }
	        else if((temp.equals("six")&& ageType.equals("words")))
	        {
	            accessed=true;
	            tempAge+=6;
	        }
	        else if((a[1].equals("six")&& ageType.equals("words-"))&&tempAge!=0) {
	            tempAge+=6;
	            accessed=true;
	        }
	        else tempAge=0;
	    }
	    else if(temp.equals("seven")&& ageType.equals("words")|| (a[1].equals("seven")&& ageType.equals("words-")))
	    {
	        if((a[1].equals("seven")&& ageType.equals("words-"))&& tempAge==0) {
	            accessed=false;
	            tempAge=0;
	        }
	        else if((temp.equals("seven")&& ageType.equals("words")))
	        {
	            accessed=true;
	            tempAge+=7;
	        }
	        else if((a[1].equals("seven")&& ageType.equals("words-"))&&tempAge!=0) {
	            tempAge+=7;
	            accessed=true;
	        }
	        else tempAge=0;
	    }
	    else if(temp.equals("eight")&& ageType.equals("words")|| (a[1].equals("eight")&& ageType.equals("words-")))
	    {
	        if((a[1].equals("eight")&& ageType.equals("words-"))&& tempAge==0) {
	            accessed=false;
	            tempAge=0;
	        }
	        else if((temp.equals("eight")&& ageType.equals("words")))
	        {
	            accessed=true;
	            tempAge+=8;
	        }
	        else if((a[1].equals("eight")&& ageType.equals("words-"))&&tempAge!=0) {
	            tempAge+=8;
	            accessed=true;
	        }
	        else tempAge=0;
	    }
	    else if(temp.equals("nine")&& ageType.equals("words")|| (a[1].equals("nine")&& ageType.equals("words-")))
	    {
	        if((a[1].equals("nine")&& ageType.equals("words-"))&& tempAge==0) {
	            accessed=false;
	            tempAge=0;
	        }
	        else if((temp.equals("nine")&& ageType.equals("words")))
	        {
	            accessed=true;
	            tempAge+=9;
	        }
	        else if((a[1].equals("nine")&& ageType.equals("words-"))&&tempAge!=0) {
	            tempAge+=9;
	            accessed=true;
	        }
	        else tempAge=0;
	    }
            if(accessed==false)tempAge=0;
                return tempAge;//Possibly return int value based on written age
                
	}
	public boolean done()
	{
		return done;
	}
        public String stringSSN() 
        {
                String newSSN="";
                String temp=String.valueOf(getSSN());
                char[] tempSSN=temp.toCharArray();
                for(int i=0;i<temp.length();i++) 
                {
                    if(i==2 || i==4) 
                    {
                        newSSN+=String.valueOf(tempSSN[i]);
                        newSSN+="-";
                    }
                    else newSSN+=String.valueOf(tempSSN[i]);
                }
                return newSSN;
        }

	public String toString()
	{
		return "\nFirst Name: " + getFName() + "\nLast Name: " + getLName() + "\nMiddle Name: " + getMName() + "\nAge:" + getAge() + "\nSSN: " + stringSSN();
	}
}

